package com.zr.sparesubclass.controller;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zr.sparesubclass.bean.SupplierDetails;
import com.zr.sparesubclass.model.*;
import com.zr.sparesubclass.service.InqueryService;
import com.zr.util.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class InqueryController {
    @Autowired
    private InqueryService inqueryService;
    @Autowired
    private DownService downService;
    @PostMapping("inquiryList/selectMaterial")
    @CrossOrigin
    public ResultVO<AllRecords> search(@RequestBody AddSpareVo addSpareVo){
       return inqueryService.search(addSpareVo);
    }

    @PostMapping("material/searchPartnerPage")
    @CrossOrigin
    public ResultVO<AllRecords> searchPartnerPage(@RequestBody SearchPartnerPageVo searchPartnerPageVo){
        return inqueryService.searchPartnerPage(searchPartnerPageVo);
    }

    @PostMapping("inquiryList/search")
    @CrossOrigin
   public ResultVO<AllRecords> inquiryListsearch(@RequestBody @Valid InquiryListVo inquiryListVo){
        return inqueryService.inquiryListsearch(inquiryListVo);
    }

    @PostMapping("procurement/getPullDownList")
    @CrossOrigin
    public ResultVO<DownList> getPullDownList(@RequestBody List<String> list){
        return downService.getPullDownList(list);
    }
    //?legalPersonId="+_this.formInline.legalPersonId
    @GetMapping("partner/queryByLegalPerson")
    @CrossOrigin
    public ResultVO<List<SupplierDetails>> getSupplierDetails(@RequestParam Integer legalPersonId){
        return inqueryService.getSupplierDetails(legalPersonId);
    }
    @PostMapping("inquiryList/add")
    @CrossOrigin
    public ResultVO<InquiryListAddVo> inquiryListAdd(@RequestBody InquiryListAddVo inquiryListAddVo){
        return inqueryService.inquiryListAdd(inquiryListAddVo);
    }
    @PostMapping("inquirySheet/see")
    @CrossOrigin
    public ResultVO<InquiryListAddVo> queryById(@RequestBody MidifyIdVO midifyIdVO){
        return inqueryService.queryById(midifyIdVO);
    }
    @PostMapping("inquiryList/update")
    @CrossOrigin
    public ResultVO<InquiryListAddVo> inquiryListUpdate(@RequestBody InquiryListAddVo inquiryListAddVo){
        return inqueryService.inquiryListUpdate(inquiryListAddVo);
    }
    @PostMapping("inquiryAuditor/update")
    @CrossOrigin
    public ResultVO<ExamineVo> inquiryAuditorupdate(@RequestBody @Valid ExamineVo examineVo){
        return inqueryService.inquiryAuditorupdate(examineVo);
    }

    @PostMapping("inquiryApprover/update")
    @CrossOrigin
    public ResultVO<ApprovalVo> inquiryApproverupdate(@RequestBody @Valid ApprovalVo approvalVo){
        return inqueryService.inquiryApproverupdate(approvalVo);
    }

    @PostMapping("inquiryList/modifyState")
    @CrossOrigin
    public ResultVO<VoidVo> inquiryListmodifyState(@RequestBody @Valid VoidVo voidVo){
        return inqueryService.inquiryListmodifyState(voidVo);
    }
    @PostMapping("quotationList/search")
    @CrossOrigin
    public ResultVO<AllRecords> quotationListsearch(@RequestBody @Valid QuotationListVo quotationListVo){
        return inqueryService.quotationListsearch(quotationListVo);
    }

    @PostMapping("quotationList/searchPre")
    @CrossOrigin
    public ResultVO<AllRecords> quotationListsearchPre(@RequestBody @Valid QutationListVo qutationListVo){
        return inqueryService.quotationListsearchPre(qutationListVo);
    }
}
